package methods

import "fmt"

type Student struct {
	name string
	age  int
}

func (student *Student) info() {
	fmt.Printf("我叫做%s， 今年%d岁了\n", student.name, student.age)
	student.age = 102
}

func Defer() {
	students := [...]Student{
		{
			"李二",
			10,
		},
		{
			"张三",
			10,
		},
		{
			"王五",
			14,
		},
	}

	for _, student := range students {
		tmp := student
		defer tmp.info()
	}
}
